pub fn word_pattern(pattern: String, s: String) -> bool {
    let words: Vec<&str> = s.split(" ").collect();
    let mut maps = [""; 26];
    const LOW_A: usize = 'a' as usize;
    let chars: Vec<char> = pattern.chars().collect();
    let mut maped_words: Vec<&str> = vec![];

    if chars.len() != words.len() {
        return false;
    }

    for i in 0..chars.len() {
        let c = chars[i];
        let word = words[i];
        let index = c as usize - LOW_A;
        let maped = maps[index];
        if maped == "" {
            if maped_words.contains(&word) {
                return false;
            }
            maped_words.push(word);
            maps[index] = word;
        } else {
            if maped != word {
                return false;
            }
        }
    }

    return true;
}
